<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?><!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="Bookmark" href="/favicon.ico" >
    <link rel="Shortcut Icon" href="/favicon.ico" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="/public/js/html5shiv.js"></script>
    <script type="text/javascript" src="/public/js/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="/public/plugins/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="/public/plugins/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="/public/plugins/Hui-iconfont/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="/public/plugins/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="/public/plugins/h-ui.admin/css/style.css" />
    <script type="text/javascript" src="/public/plugins/My97DatePicker/WdatePicker.js"></script>
    
    <!--[if IE 6]>
    <script type="text/javascript" src="/public/js/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title>快方管理后台</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <style type="text/css">
        .input-text{
            width: 100px;
            background: none;
        }
        .cb_label{
            padding: 0 5px;
        }
        .cb_label input{
            margin-right: 2px;
        }
    </style>
</head>
<body class="big-page">
<form id="form">
<table class="table table-border" id="mytable">
    
    <tr id='row'>
        <td colspan="2" style="text-align:center;font-size: 18px;">
            <?php
                switch ($data['ZT']) {
                    case 0:
                        echo $data['PTNAME'].'&nbsp;&nbsp;&nbsp;&nbsp;未创建';
                        break;
                    case 1:
                        echo $data['PTNAME'].'&nbsp;&nbsp;&nbsp;&nbsp;已上线';
                        break;
                    case 2:
                        echo $data['PTNAME'].'&nbsp;&nbsp;&nbsp;&nbsp;已下线';
                        break;                   
                    default:
                        echo $data['PTNAME'].'&nbsp;&nbsp;&nbsp;&nbsp;未创建';
                        break;
                }
            ?>

        </td>
    </tr>

    <tr class="control">
        <td colspan="2" style="text-align: center;">
                    <?php
                        if($data['PTID'] == 6)
                        {
                    ?>
                     行政区划代码：<input type="text" name="city_code" value="" size="8">
                     <a href="http://www.stats.gov.cn/tjsj/tjbz/xzqhdm/201504/t20150415_712722.html" target="_blank">查询</a> 
                    <?php
                        }
                    ?>
                                                                  
                     <input type="button" name="create" id="create" class="btn btn-info radius" value="上传">&emsp;
                     <input type="button" name="up" id="up" class="btn btn-success radius" value="上线">
                     &emsp;
                     <input type="button" name="down" id="down" class="btn btn-danger radius" value="下线">                                            
                                 
        </td>
    </tr>
</table>
</form>
<script type="text/javascript" src="/public/js/jquery.min.js"></script>
<script type="text/javascript" src="/public/plugins/layer/layer.js"></script>
<script type="text/javascript" src="/public/plugins/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="/public/plugins/h-ui.admin/js/H-ui.admin.js"></script>
<script type="text/javascript" src="/public/plugins/jquery.contextmenu/jquery.contextmenu.r2.js"></script>
<script type="text/javascript">
//创建门店
$("#create").bind("click", function(){
    var create_url = "<?php echo $data['create_url'];?>" ;
    var store_id = "<?php echo $_GET['YID'];?>" ;
    var city_code = $("input[name='city_code']").val();
    $.ajax({
        url: create_url,
        type: "POST",
        dataType: "json",
        data: {store_id:store_id, city_code:city_code},
        success:function(res){
            if(res.code == 0){
                parent.dataTables.draw(false);
                parent.layer.closeAll();
            }else{
                alert(res.msg);
            }

        }
    });     
})

//门店上线
$("#up").bind("click", function(){
    var store_id = "<?php echo $_GET['YID'];?>"  ;
    var ptid = "<?php echo $_GET['PTID'];?>" ;
    var zt = 1 ;
    $.ajax({
        url: '/AddStore/updatePtStatusByYid',
        type: "POST",
        dataType: "json",
        data: {store_id:store_id,ptid:ptid,zt:zt},
        success:function(res){
            if(res.code == 0){
                parent.dataTables.draw(false);
                parent.layer.closeAll();
            }else{
                alert(res.msg);
            }

        }
    });     
})
//门店下线
$("#down").bind("click", function(){
    var store_id = "<?php echo $_GET['YID'];?>"  ;
    var ptid = "<?php echo $_GET['PTID'];?>" ;
    var zt = 2 ;
    $.ajax({
        url: '/AddStore/updatePtStatusByYid',
        type: "POST",
        dataType: "json",
        data: {store_id:store_id,ptid:ptid,zt:zt},
        success:function(res){
            if(res.code == 0){
                parent.dataTables.draw(false);
                parent.layer.closeAll();
            }else{
                alert(res.msg);
            }

        }
    });     
})
</script>
</body>
</html>
